package com.study.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import com.study.dao.TableManagerDao;

@Component
public class TableManagerService {
	// private static Logger
	@Autowired
	private TableManagerDao tableMgrDao;

	public void dropTable(String tableName) {
		if (StringUtils.isEmpty(tableName)) {

			throw new RuntimeException("table name is null");
		}
		tableMgrDao.dropTable(tableName);
	}

	public void createTable(String tableName) {
		if (StringUtils.isEmpty(tableName)) {

			throw new RuntimeException("table name is null");
		}
		tableMgrDao.createTable(tableName);
	}

	public int existTable(String tableName) {
		if (StringUtils.isEmpty(tableName)) {

			throw new RuntimeException("table name is null");
		}
		return tableMgrDao.existTable(tableName);
	}

}
